// hyb_yl/doctorHome/pages/acceptpatient/acceptpatient.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    back_orser:"",
    j_id:"",
    zid:"",
  },
  big_img:function(e){
    var urls=e.currentTarget.dataset.urls;
    var url=e.currentTarget.dataset.url;
    wx.previewImage({
      urls: urls,
      current:url
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var id = options.id;
    var that = this;
    that.setData({
      id:id,
      typs:options.typs,
      j_id:options.j_id,
      zid:options.zid
    })
    if(options.back_orser != '')
    {
      that.setData({
        back_orser:options.back_orser
      })
    }
    that.getDetail();
  },
  getDetail:function(e){
    var that = this;
    app.util.request({
      'url':"entry/wxapp/follow.report_detail",
      data:{
        id:that.data.id,
        back_orser:that.data.back_orser,
        j_id:that.data.j_id,
      },
      success:function(res)
      {
        that.setData({
          info:res.data
        })
      }
    })
  },
  agree(e) {
    var that = this
    var id = that.data.id
    var j_id = that.data.info.j_id;
    var zid = wx.getStorageSync('zid')
    app.util.request({
      'url': 'entry/wxapp/zhuanjia.updateqianyue',
      data: {
        id: id
      },
      success: function (res) {
        console.log(res)
        wx.showModal({
          title: '提示',
          content:'是否立即分组',
          success:function(con)
          {
            if(con.confirm)
            {
              wx.navigateTo({
                url: '/hyb_yl/mysubpages/pages/grouping_list/grouping_list?a_id='+id+'&j_id='+j_id+'&typs=fenzu',
              })
            }
          }
        })
      }
    })
  },
  disagree(e) {
    var that = this
    var id = that.data.id
    var zid = wx.getStorageSync('zid')
    app.util.request({
      'url': 'entry/wxapp/zhuanjia.updatejujueqianyue',
      data: {
        id: id
      },
      success: function (res) {
        wx.navigateBack({})
      }
    })
  },
  // 添加患者随访计划
  addsuifang:function(e){
    wx.navigateTo({
      url: '/hyb_yl/doctorHome/pages/distribution/distribution?j_id='+this.data.info.j_id+'&id='+this.data.info.id+'&zid='+this.data.zid,
    })
  },
  // 查看患者随访
  seesuifang:function(e){
    wx.navigateTo({
      url: '/hyb_yl/doctorHome/pages/result_task/result_task?j_id='+this.data.info.j_id+'&id='+this.data.info.id+'&zid='+this.data.zid,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})